package com.cy.pj.sys.controller;

import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.sys.pojo.SysSale;
import com.cy.pj.sys.pojo.SysUser;
import com.cy.pj.sys.service.SysSaleService;
import com.cy.pj.sys.service.SysUserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RequestMapping("/sale/")
@RestController
public class SysSaleController {

    @Autowired
    private SysSaleService sysSaleService;


    @RequestMapping("doFindPageObjects")
    public JsonResult doFindPageObjects(String name, Long pageCurrent){
        return new JsonResult(sysSaleService.findPageObjects(name, pageCurrent));
    }


    @RequestMapping("doValidById")
    public JsonResult doValidById(Integer id, Integer valid){
        sysSaleService.validById(id, valid);
        return new JsonResult("Update OK");
    }

    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(SysSale sysSale){
        sysSaleService.saveObject(sysSale);
        return new JsonResult("Save OK");
    }


}
